]> git.r.bdr.sh - rbdr/super-polarity/blame - Super Polarity/SuperPolarity.cs
Moves to ActorManager arch + Actor Inherited stuff
[rbdr/super-polarity] / Super Polarity / SuperPolarity.cs
CommitLineData
63a61ee2
BB
1#region Using Statements
2using System;
3using System.Collections.Generic;
4using Microsoft.Xna.Framework;
5using Microsoft.Xna.Framework.Content;
6using Microsoft.Xna.Framework.Graphics;
7using Microsoft.Xna.Framework.Input;
8using Microsoft.Xna.Framework.Storage;
9using Microsoft.Xna.Framework.GamerServices;
10using SuperPolarity;
11#endregion
12
13namespace SuperPolarity
14{
15 /// <summary>
16 /// This is the main type for your game
17 /// </summary>
18 public class SuperPolarity : Game
19 {
95d7601b 20 public static GraphicsDeviceManager graphics;
63a61ee2
BB
21 SpriteBatch spriteBatch;
22
63a61ee2
BB
23 public SuperPolarity()
24 : base()
25 {
95d7601b
BB
26 SuperPolarity.graphics = new GraphicsDeviceManager(this);
27 SuperPolarity.graphics.PreferMultiSampling = true;
63a61ee2 28 Content.RootDirectory = "Content";
f8aec187 29 ActorFactory.SetContentManager(Content);
63a61ee2
BB
30 }
31
32 /// <summary>
33 /// Allows the game to perform any initialization it needs to before starting to run.
34 /// This is where it can query for any required services and load any non-graphic
35 /// related content. Calling base.Initialize will enumerate through any components
36 /// and initialize them as well.
37 /// </summary>
38 protected override void Initialize()
39 {
63a61ee2
BB
40 base.Initialize();
41 }
42
43 /// <summary>
44 /// LoadContent will be called once per game and is the place to load
45 /// all of your content.
46 /// </summary>
47 protected override void LoadContent()
48 {
49 // Create a new SpriteBatch, which can be used to draw textures.
50 spriteBatch = new SpriteBatch(GraphicsDevice);
51
52 Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
53
f8aec187 54 ActorFactory.CreateMainShip(playerPosition);
63a61ee2
BB
55 }
56
57 /// <summary>
58 /// UnloadContent will be called once per game and is the place to unload
59 /// all content.
60 /// </summary>
61 protected override void UnloadContent()
62 {
63 // TODO: Unload any non ContentManager content here
64 }
65
66 /// <summary>
67 /// Allows the game to run logic such as updating the world,
68 /// checking for collisions, gathering input, and playing audio.
69 /// </summary>
70 /// <param name="gameTime">Provides a snapshot of timing values.</param>
71 protected override void Update(GameTime gameTime)
72 {
73 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
74 Exit();
75
76 // TODO: Add your update logic here
77
95d7601b 78 InputController.UpdateInput();
f8aec187 79 ActorManager.Update(gameTime);
95d7601b 80
63a61ee2
BB
81 base.Update(gameTime);
82 }
83
84 /// <summary>
85 /// This is called when the game should draw itself.
86 /// </summary>
87 /// <param name="gameTime">Provides a snapshot of timing values.</param>
88 protected override void Draw(GameTime gameTime)
89 {
95d7601b 90 GraphicsDevice.Clear(Color.White);
63a61ee2
BB
91
92 spriteBatch.Begin();
93
f8aec187 94 ActorManager.Draw(spriteBatch);
63a61ee2
BB
95
96 spriteBatch.End();
97
98 base.Draw(gameTime);
99 }
100 }
101}